<template>
	<view class="page-box">
		<view class="header">
			<cu-custom :isBack="true" :backColor="headerBgColor">
				<block slot="backText"></block>
				<block slot="content">
					<text class="nav-title shopro-selector-rect">购买记录</text>
				</block>
			</cu-custom>
		</view>

		<view class="content">
			<view class="content-box">
				<view class="content-top">
					<view class="content-time">购买时间</view>
					<view class="line"></view>
					<view class="price">购买金额</view>
				</view>
				<block v-for="(item,index) in record" :key="index">
					<view class="content-bottom">
						<view class="content-time">{{item.createtime}}</view>
						<view class="content-price">-{{item.price}}</view>
					</view>
				</block>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				headerBgColor: 'transparent',
				record: []
			}
		},
		onLoad() {
			this.vipRecord()
		},
		methods: {
			vipRecord() {
				this.$apiBase('vipRecord', null).then(res => {
					this.record = res.data.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.page-box {
		width: 100vw;
		height: 100vh;
		background-color: #F8F7FC;

		.header {

			.cu-bar .action>text[class*="cuIcon-"],
			.cu-bar .action>view[class*="cuIcon-"] {
				font-size: 47rpx;
			}

			.cu-bar .content {
				top: 88rpx;
			}

			.nav-title {
				font-size: 40rpx;
				font-weight: bold;
				color: #000000;

			}
		}

		.content {
			display: flex;
			flex-direction: column;

			.content-box {
				width: calc(100% - 60rpx);
				margin-left: 30rpx;
				margin-right: 30rpx;
				margin-top: 45rpx;
				margin-bottom: 100rpx;
				height: 100%;
				background: #FFFFFF;
				border-radius: 20rpx 20rpx 0rpx 0rpx;

				.content-top {
					height: 80rpx;
					background: #EC961A;
					border-radius: 20rpx 20rpx 0rpx 0rpx;
					display: flex;
					justify-content: space-between;

					.content-time {
						font-size: 28rpx;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 80rpx;
						padding-left: 117rpx;
					}

					.line {
						width: 2rpx;
						height: 28rpx;
						background: #FFFFFF;
						opacity: 0.5;
						margin-top: 28rpx;
					}

					.price {
						font-size: 28rpx;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 80rpx;
						padding-right: 146rpx;
					}
				}

				.content-bottom {
					display: flex;
					justify-content: space-between;
					padding-top: 37rpx;
					padding-bottom: 38rpx;
					border-bottom: 1rpx solid #F0F0F0;
					box-sizing: border-box;

					.content-time {
						font-size: 26rpx;
						font-weight: 500;
						color: #1A1A1A;
						padding-left: 60rpx;
					}

					.content-price {
						font-size: 26rpx;
						font-weight: 500;
						color: #1A1A1A;
						padding-right: 164rpx;
					}
				}
			}
		}
	}
</style>
